package com.yzc.mihuyou.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yzc.mihuyou.entity.Invitation;
import com.yzc.mihuyou.entity.PageWuer;
import com.yzc.mihuyou.mapper.InvitationMapper;
import com.yzc.mihuyou.service.InvitationService;
import com.yzc.mihuyou.service.UserimgService;
import com.yzc.mihuyou.util.ImgServe;
import com.yzc.mihuyou.vo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  头像
 * </p>
 *
 * @author 易紫诚
 * @since 2022-05-02
 */
@RestController
@RequestMapping("/mihuyou/userimg")
public class UserimgController {

    @Autowired
    UserimgService userimgService;

    @PostMapping("iset")
    public  String text(@RequestPart("photos") MultipartFile photos){
        userimgService.importProfession(photos);
        return "";
    }

     @GetMapping("userImg")
    public JsonResult arrQuer(){
         Map<String,Object> map=new HashMap<>();
         map.put("img",userimgService.arrImg());
        return  new JsonResult(200,"获取成功",map);
     }

     @PostMapping("addImg")
     public JsonResult addImg(@RequestPart("photos") MultipartFile photos){
         Map<String,Object> map=new HashMap<>();
         map.put("img", ImgServe.uploadImg(photos));
         return  new JsonResult(200,"上传成功",map);
     }

    @GetMapping ("addImg")
    public JsonResult addImgs(@RequestPart("photos") MultipartFile photos){
        Map<String,Object> map=new HashMap<>();
        map.put("img", ImgServe.uploadImg(photos));
        return  new JsonResult(200,"上传成功",map);
    }

}

